<?php
// +----------------------------------------------------------------------
// | 海豚PHP框架 [ DolphinPHP ]
// +----------------------------------------------------------------------
// | 版权所有 2016~2017 河源市卓锐科技有限公司 [ http://www.zrthink.com ]
// +----------------------------------------------------------------------
// | 官方网站: http://dolphinphp.com
// +----------------------------------------------------------------------
// | 开源协议 ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------

namespace app\member\validate;

use think\Validate;

/**
 * 行为验证器
 * @package app\admin\validate
 * @author 蔡伟明 <314013107@qq.com>
 */
class Address extends Validate
{
    //定义验证规则
    protected $rule = [
        'member_id|会员名称' => 'require',
        'consignee|收货人' => 'require',
        'mobile|手机号'   => 'regex:^1[0-9]{10}$',
        'tel|固话'   => 'regex:0\d{2,3}-\d{5,9}|0\d{2,3}-\d{5,9}',
        'province|省份' => 'require',
        'city|城市'   => 'require',
        'address|详细地址'   => 'require',
    ];

    //定义验证提示
    protected $message = [
        'member_id.require' => '请选择会员',
        'consignee.require' => '请输入收货人',
        'mobile.regex'     => '手机号格式不正确',
        'tel.regex'     => '固话格式不正确',
        'province.require' => '请选择省份',
        'city.require'     => '请选择城市',
        'address.require'     => '请输入详细地址',
    ];
}
